<template>
  <dt-modal-edit ref='edit' :title='title' :label-width='130' :width='500' @ok='onOk'>
  </dt-modal-edit>
</template>

<script>
  import allowanceSbumitOpt from '../opt/allowanceSbumit'

  import incentiveMgr from '@/biz/bonus/incentive'
  export default {
    props: ['detailsData'],
    data() {
      return {
        info: {
          allowanceMonth: '',
          allowanceMoney: '',
          oaNumber: '',
          accessoryBOList: [],
          remark: '',
        },
        title: '项目津贴提交',
      }
    },
    mounted() {},
    watch: {
      detailsData(val) {
        this.detailsData = val
        console.log(this.detailsData, 'watch')
        this.info.allowanceMonth = this.detailsData.allowanceMonth
        this.info.allowanceMoney = this.detailsData.allowanceMoney
      },
    },
    methods: {
      create() {
        this.$refs.edit.show(allowanceSbumitOpt.options(this), this.info)
      },
      hide() {
        this.$refs.edit.hide()
      },
      onOk() {
        console.log(this.info, 'this.info')
        // initiateMgr.create(this.info).then((res) => {
        //   this.$emit('success', res)
        //   this.hide()
        // })
        let params = {
          allowanceId: this.$route.query.allowanceId,
          oaNumber: this.info.oaNumber,
          remark: this.info.remark,
          accessoryBOList: this.info.accessoryBOList,
          boAllowanceDetailInfoList: this.detailsData.boAllowanceDetailInfoList,
        }


        incentiveMgr.submitBonusAllowance(params).then((res) => {
          this.$Message.success('提交成功。')
          this.$emit('success')
          this.hide()
        })
      },
    },
  }
</script>

<style>
</style>